load("@prelude//utils:source_listing.bzl", "source_listing")
load(":defs.bzl", "cxx_hacks", "cxx_internal_tools")

oncall("build_infra")

source_listing()

prelude = native

cxx_internal_tools(
    name = "internal_tools",
    visibility = ["PUBLIC"],
)

prelude.python_bootstrap_binary(
    name = "check_nonempty_output",
    main = "check_nonempty_output.py",
    visibility = ["PUBLIC"],
)

prelude.python_bootstrap_binary(
    name = "hmap_wrapper.py",
    main = "hmap_wrapper.py",
)

prelude.command_alias(
    name = "hmap_wrapper",
    args = [
        "--hmap-tool=$(location prelude//third-party/hmaptool:hmaptool)",
    ],
    exe = ":hmap_wrapper.py",
    labels = ["buck2-only"],
    visibility = ["PUBLIC"],
)

prelude.python_bootstrap_binary(
    name = "make_comp_db",
    main = "make_comp_db.py",
    visibility = ["PUBLIC"],
)

prelude.python_bootstrap_binary(
    name = "dep_file_processor",
    main = "dep_file_processor.py",
    visibility = ["PUBLIC"],
    deps = [
        ":dep_file_processors",
    ],
)

prelude.python_bootstrap_library(
    name = "dep_file_processors",
    srcs = [
        "dep_file_utils.py",
        "makefile_to_dep_file.py",
        "show_headers_to_dep_file.py",
        "show_includes_to_dep_file.py",
    ],
)

prelude.python_bootstrap_binary(
    name = "linker_wrapper",
    main = "linker_wrapper.py",
    visibility = ["PUBLIC"],
)

prelude.python_bootstrap_binary(
    name = "remap_cwd",
    main = "remap_cwd.py",
    visibility = ["PUBLIC"],
)

prelude.python_bootstrap_binary(
    name = "simple_ar",
    main = "simple_ar.py",
    visibility = ["PUBLIC"],
)

prelude.python_bootstrap_binary(
    name = "concatenate_diagnostics",
    main = "concatenate_diagnostics.py",
    visibility = ["PUBLIC"],
)

prelude.python_bootstrap_binary(
    name = "stderr_to_file",
    main = "stderr_to_file.py",
    visibility = ["PUBLIC"],
)

prelude.sh_binary(
    name = "serialized_diagnostics_to_json_wrapper",
    main = "serialized_diagnostics_to_json_wrapper.sh",
    visibility = ["PUBLIC"],
)

prelude.python_bootstrap_binary(
    name = "filter_argsfile",
    main = "filter_argsfile.py",
    visibility = ["PUBLIC"],
)

# Required to support the $(cxx-header-tree) macro
cxx_hacks(
    name = "cxx_hacks",
    visibility = ["PUBLIC"],
)
